package com.atguigu.day20.homework.h5;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/25 21:42
 * @注释
 */
public class PrintLetter {
    char letter = 'a';

    public synchronized void printLower() {
        for (int i = 0; i < 3; i++) {
            System.out.println(Thread.currentThread().getName() + "->" + letter++);
            if (letter > 'z') {
                letter = 'a';
            }
        }
        try {
            this.wait();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
